package cn.enilu.flash.bean.entity.bus;

import cn.enilu.flash.bean.entity.BaseEntity;
import cn.enilu.flash.bean.entity.shop.ShopUser;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Entity(name="t_bus_sport_appointment")
@Table(appliesTo = "t_bus_sport_appointment",comment = "场地预约")
@Data
@EntityListeners(AuditingEntityListener.class)
public class SportAppointment extends BaseEntity {

    @Column(name="user_id",columnDefinition = "BIGINT COMMENT '预约用户id'")
    private Long userId;

    @JoinColumn(name="user_id", insertable = false, updatable = false,foreignKey = @ForeignKey(name="none",value = ConstraintMode.NO_CONSTRAINT))
    @ManyToOne(fetch = FetchType.LAZY)
    private ShopUser user;

    @Column(name="sport_id",columnDefinition = "BIGINT COMMENT '场地id'")
    private Long sportId;

    @JoinColumn(name="sport_id", insertable = false, updatable = false,foreignKey = @ForeignKey(name="none",value = ConstraintMode.NO_CONSTRAINT))
    @ManyToOne(fetch = FetchType.LAZY)
    private Sport sport;

    private Date appointStart;

    private Date appointEnd;


}
